mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-04 11:49:16 +02:00
feat(users): use displayName alternative first name and last name
This commit is contained in:
@@ -87,6 +87,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
vm.user.lastName = '';
|
||||
var user = vm.user;
|
||||
|
||||
user.$update(function () {
|
||||
|
||||
@@ -29,6 +29,11 @@
|
||||
Notification.error({message: $location.search().err});
|
||||
}
|
||||
|
||||
// If user is signed in then redirect back home
|
||||
if (vm.authentication.user && !vm.activeMethod) {
|
||||
$location.path('/');
|
||||
}
|
||||
|
||||
/**
|
||||
* account active successfully, redirect to home after 2 seconds
|
||||
*/
|
||||
@@ -72,6 +77,7 @@
|
||||
vm.credentials.inviteToken = $stateParams.token;
|
||||
}
|
||||
|
||||
vm.credentials.lastName = '';
|
||||
UsersService.userSignup(vm.credentials)
|
||||
.then(onUserSignupSuccess)
|
||||
.catch(onUserSignupError);
|
||||
@@ -109,7 +115,7 @@
|
||||
vm.authentication.user = response;
|
||||
$rootScope.$broadcast('auth-user-changed');
|
||||
$rootScope.$broadcast('user-invitations-changed');
|
||||
Notification.info({message: 'Welcome ' + response.firstName});
|
||||
Notification.info({message: 'Welcome ' + response.displayName});
|
||||
// And redirect to the previous or home page
|
||||
$state.go($state.previous.state.name || 'home', $state.previous.params);
|
||||
}
|
||||
|
||||
@@ -22,15 +22,16 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
vm.user.lastName = '';
|
||||
var user = new UsersService(vm.user);
|
||||
|
||||
user.$update(function (response) {
|
||||
$scope.$broadcast('show-errors-reset', 'vm.userForm');
|
||||
|
||||
Notification.success({ message: '<i class="glyphicon glyphicon-ok"></i> Edit profile successful!' });
|
||||
Notification.success({message: '<i class="glyphicon glyphicon-ok"></i> Edit profile successful!'});
|
||||
Authentication.user = response;
|
||||
}, function (response) {
|
||||
Notification.error({ message: response.data.message, title: '<i class="glyphicon glyphicon-remove"></i> Edit profile failed!' });
|
||||
Notification.error({message: response.data.message, title: '<i class="glyphicon glyphicon-remove"></i> Edit profile failed!'});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,10 @@
|
||||
<form name="vm.userForm" ng-submit="vm.update(vm.userForm.$valid)" novalidate>
|
||||
<fieldset>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="firstName">First Name</label>
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" ng-model="vm.user.firstName" placeholder="First Name" required autofocus />
|
||||
<label for="firstName">{{ 'STATUS_FIELD.DISPLAY_NAME' | translate}}</label>
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" ng-model="vm.user.firstName" placeholder="{{ 'STATUS_FIELD.DISPLAY_NAME' | translate}}" required autofocus />
|
||||
<div ng-messages="vm.userForm.firstName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">First name is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="lastName">Last Name</label>
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" ng-model="vm.user.lastName" placeholder="Last Name" required />
|
||||
<div ng-messages="vm.userForm.lastName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Last name is required.</p>
|
||||
<p class="help-block error-text" ng-message="required">{{ 'STATUS_FIELD.DN_REQUIRED' | translate}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
|
||||
@@ -34,12 +34,6 @@
|
||||
<dt class="h-line">{{ 'STATUS_FIELD.USERNAME' | translate}}:</dt>
|
||||
<dd class="h-line">{{ vm.user.username }}</dd>
|
||||
|
||||
<!--<dt class="h-line">{{ 'STATUS_FIELD.FIRST_NAME' | translate}}:</dt>-->
|
||||
<!--<dd class="h-line">{{ vm.user.firstName }}</dd>-->
|
||||
|
||||
<!--<dt class="h-line">{{ 'STATUS_FIELD.LAST_NAME' | translate}}:</dt>-->
|
||||
<!--<dd class="h-line">{{ vm.user.lastName }}</dd>-->
|
||||
|
||||
<dt class="h-line">{{ 'STATUS_FIELD.DISPLAY_NAME' | translate}}:</dt>
|
||||
<dd class="h-line">
|
||||
{{ vm.user.displayName }}
|
||||
|
||||
@@ -12,18 +12,10 @@
|
||||
<fieldset>
|
||||
<div class="form-group" show-errors>
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" ng-model="vm.credentials.firstName"
|
||||
placeholder="{{ 'STATUS_FIELD.FIRST_NAME' | translate}}" required autofocus>
|
||||
placeholder="{{ 'STATUS_FIELD.DISPLAY_NAME' | translate}}" required autofocus>
|
||||
|
||||
<div ng-messages="vm.userForm.firstName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">{{ 'SIGN.FN_REQUIRED' | translate}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" ng-model="vm.credentials.lastName"
|
||||
placeholder="{{ 'STATUS_FIELD.LAST_NAME' | translate}}" required>
|
||||
|
||||
<div ng-messages="vm.userForm.lastName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">{{ 'SIGN.LN_REQUIRED' | translate}}</p>
|
||||
<p class="help-block error-text" ng-message="required">{{ 'SIGN.DN_REQUIRED' | translate}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
|
||||
@@ -3,23 +3,13 @@
|
||||
<form name="vm.userForm" ng-submit="vm.updateUserProfile(vm.userForm.$valid)" class="signin" novalidate autocomplete="off">
|
||||
<fieldset>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="firstName">{{ 'STATUS_FIELD.FIRST_NAME' | translate}}</label>
|
||||
<label for="firstName">{{ 'STATUS_FIELD.DISPLAY_NAME' | translate}}</label>
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" ng-model="vm.user.firstName"
|
||||
placeholder="{{ 'STATUS_FIELD.FIRST_NAME' | translate}}"
|
||||
placeholder="{{ 'STATUS_FIELD.DISPLAY_NAME' | translate}}"
|
||||
required autofocus>
|
||||
|
||||
<div ng-messages="vm.userForm.firstName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">{{ 'SIGN.FN_REQUIRED' | translate}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="lastName">{{ 'STATUS_FIELD.LAST_NAME' | translate}}</label>
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" ng-model="vm.user.lastName"
|
||||
placeholder="{{ 'STATUS_FIELD.LAST_NAME' | translate}}"
|
||||
required>
|
||||
|
||||
<div ng-messages="vm.userForm.lastName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">{{ 'SIGN.LN_REQUIRED' | translate}}</p>
|
||||
<p class="help-block error-text" ng-message="required">{{ 'SIGN.DN_REQUIRED' | translate}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
|
||||
@@ -21,12 +21,6 @@
|
||||
<dt class="h-line">{{ 'STATUS_FIELD.USERNAME' | translate}}:</dt>
|
||||
<dd class="h-line">{{ vm.user.username }}</dd>
|
||||
|
||||
<!--<dt class="h-line">{{ 'STATUS_FIELD.FIRST_NAME' | translate}}:</dt>-->
|
||||
<!--<dd class="h-line">{{ vm.user.firstName }}</dd>-->
|
||||
|
||||
<!--<dt class="h-line">{{ 'STATUS_FIELD.LAST_NAME' | translate}}:</dt>-->
|
||||
<!--<dd class="h-line">{{ vm.user.lastName }}</dd>-->
|
||||
|
||||
<dt class="h-line">{{ 'STATUS_FIELD.DISPLAY_NAME' | translate}}:</dt>
|
||||
<dd class="h-line">
|
||||
{{ vm.user.displayName }}
|
||||
|
||||
@@ -27,12 +27,6 @@
|
||||
<dt class="h-line">{{ 'STATUS_FIELD.USERNAME' | translate}}:</dt>
|
||||
<dd class="h-line">{{ vm.user.username }}</dd>
|
||||
|
||||
<!--<dt class="h-line">{{ 'STATUS_FIELD.FIRST_NAME' | translate}}:</dt>-->
|
||||
<!--<dd class="h-line">{{ vm.user.firstName }}</dd>-->
|
||||
|
||||
<!--<dt class="h-line">{{ 'STATUS_FIELD.LAST_NAME' | translate}}:</dt>-->
|
||||
<!--<dd class="h-line">{{ vm.user.lastName }}</dd>-->
|
||||
|
||||
<dt class="h-line">{{ 'STATUS_FIELD.DISPLAY_NAME' | translate}}:</dt>
|
||||
<dd class="h-line">
|
||||
{{ vm.user.displayName }}
|
||||
|
||||
@@ -57,13 +57,13 @@ var UserSchema = new Schema({
|
||||
type: String,
|
||||
trim: true,
|
||||
default: '',
|
||||
validate: [validateLocalStrategyProperty, 'Please fill in your first name']
|
||||
validate: [validateLocalStrategyProperty, 'Please fill in your display name']
|
||||
},
|
||||
lastName: {
|
||||
type: String,
|
||||
trim: true,
|
||||
default: '',
|
||||
validate: [validateLocalStrategyProperty, 'Please fill in your last name']
|
||||
default: ''
|
||||
//validate: [validateLocalStrategyProperty, 'Please fill in your last name']
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
|
||||
Reference in New Issue
Block a user