Skip to content

Commit 7f6cb92

Browse files
committed
MOBILE-2103 login: Show logo if avatar not set on reconect
1 parent 48d43a1 commit 7f6cb92

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

www/core/components/login/controllers/reconnect.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ angular.module('mm.core.login')
4545

4646
$scope.credentials.username = site.infos.username;
4747
$scope.siteurl = site.infos.siteurl;
48+
$scope.sitename = site.infos.sitename;
49+
50+
// Check logoURL if user avatar is not set.
51+
if ($scope.site.avatar.startsWith(site.infos.siteurl + '/theme/image.php')) {
52+
$scope.site.avatar = false;
53+
return site.getPublicConfig().then(function(config) {
54+
$scope.logourl = config.logourl || config.compactlogourl;
55+
});
56+
}
4857
});
4958

5059
if (siteConfig) {

www/core/components/login/templates/reconnect.html

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22
<ion-content mm-state-class padding="true" class="mm-center-view">
33
<div class="mm-view-content">
44
<div class="box">
5-
<div class="item item-text-wrap item-avatar-center item-borderless">
6-
<img ng-src="{{site.avatar}}" class="avatar" mm-external-content siteid="site.id" alt="{{ 'mm.core.pictureof' | translate:{$a: site.fullname} }}" role="presentation">
7-
<h2 class="padding">{{siteurl}}</h2>
8-
<p ng-if="!isLoggedOut"><i class="icon ion-alert-circled padding"></i> {{ 'mm.login.reconnectdescription' | translate }}</p>
5+
<div class="item item-text-wrap item-avatar-center item-borderless" ng-class="{'item-avatar-center': site.avatar, 'text-center': !site.avatar}">
6+
<img ng-if="site.avatar" ng-src="{{site.avatar}}" class="avatar" mm-external-content siteid="site.id" alt="{{ 'mm.core.pictureof' | translate:{$a: site.fullname} }}" role="presentation">
7+
<!-- Show site logo or a default image. -->
8+
<img ng-if="!site.avatar && logourl" ng-src="{{logourl}}" class="avatar-full" mm-external-content role="presentation">
9+
<img ng-if="!site.avatar && !logourl" ng-src="img/moodle.png" class="avatar-full moodle-logo" role="presentation">
10+
11+
<!-- If no sitename show big siteurl. -->
12+
<p ng-if="!sitename" class="item-heading padding">{{siteurl}}</p>
13+
<!-- If sitename, show big sitename and small siteurl. -->
14+
<p ng-if="sitename" class="item-heading padding">{{sitename}}</p>
15+
<p ng-if="sitename">{{siteurl}}</p>
16+
17+
<p class="padding-top" ng-if="!isLoggedOut"><i class="icon ion-alert-circled padding"></i> {{ 'mm.login.reconnectdescription' | translate }}</p>
918
</div>
1019
<div class="list item padding">
1120
<h2>{{ 'mm.login.username' | translate }}</h2>

0 commit comments

Comments
 (0)