mirror of
https://github.com/flarum/framework.git
synced 2024-11-27 02:53:37 +08:00
Rename user.isActivated
This commit is contained in:
parent
d9d8162684
commit
70058652b5
|
@ -12,7 +12,7 @@ Object.assign(User.prototype, {
|
|||
username: Model.attribute('username'),
|
||||
displayName: Model.attribute('displayName'),
|
||||
email: Model.attribute('email'),
|
||||
isActivated: Model.attribute('isActivated'),
|
||||
isEmailConfirmed: Model.attribute('isEmailConfirmed'),
|
||||
password: Model.attribute('password'),
|
||||
|
||||
avatarUrl: Model.attribute('avatarUrl'),
|
||||
|
|
|
@ -15,7 +15,7 @@ export default class EditUserModal extends Modal {
|
|||
|
||||
this.username = m.prop(user.username() || '');
|
||||
this.email = m.prop(user.email() || '');
|
||||
this.isActivated = m.prop(user.isActivated() || false);
|
||||
this.isEmailConfirmed = m.prop(user.isEmailConfirmed() || false);
|
||||
this.setPassword = m.prop(false);
|
||||
this.password = m.prop(user.password() || '');
|
||||
this.groups = {};
|
||||
|
@ -50,7 +50,7 @@ export default class EditUserModal extends Modal {
|
|||
<input className="FormControl" placeholder={extractText(app.translator.trans('core.forum.edit_user.email_label'))}
|
||||
bidi={this.email} />
|
||||
</div>
|
||||
{!this.isActivated() ? (
|
||||
{!this.isEmailConfirmed() ? (
|
||||
<div>
|
||||
{Button.component({
|
||||
className: 'Button Button--block',
|
||||
|
@ -115,11 +115,11 @@ export default class EditUserModal extends Modal {
|
|||
this.loading = true;
|
||||
const data = {
|
||||
username: this.username(),
|
||||
isActivated: true,
|
||||
isEmailConfirmed: true,
|
||||
};
|
||||
this.props.user.save(data, {errorHandler: this.onerror.bind(this)})
|
||||
.then(() => {
|
||||
this.isActivated(true);
|
||||
this.isEmailConfirmed(true);
|
||||
this.loading = false;
|
||||
m.redraw();
|
||||
})
|
||||
|
|
|
@ -10,7 +10,7 @@ import icon from '../../common/helpers/icon';
|
|||
export default function alertEmailConfirmation(app) {
|
||||
const user = app.session.user;
|
||||
|
||||
if (!user || user.isActivated()) return;
|
||||
if (!user || user.isEmailConfirmed()) return;
|
||||
|
||||
const resendButton = Button.component({
|
||||
className: 'Button Button--link',
|
||||
|
|
|
@ -22,7 +22,7 @@ class CurrentUserSerializer extends UserSerializer
|
|||
$attributes = parent::getDefaultAttributes($user);
|
||||
|
||||
$attributes += [
|
||||
'isActivated' => (bool) $user->is_email_confirmed,
|
||||
'isEmailConfirmed' => (bool) $user->is_email_confirmed,
|
||||
'email' => $user->email,
|
||||
'readTime' => $this->formatDate($user->marked_all_as_read_at),
|
||||
'unreadNotificationsCount' => (int) $user->getUnreadNotificationsCount(),
|
||||
|
|
|
@ -56,8 +56,8 @@ class UserSerializer extends BasicUserSerializer
|
|||
|
||||
if ($canEdit || $this->actor->id === $user->id) {
|
||||
$attributes += [
|
||||
'isActivated' => (bool) $user->is_email_confirmed,
|
||||
'email' => $user->email
|
||||
'isEmailConfirmed' => (bool) $user->is_email_confirmed,
|
||||
'email' => $user->email
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ class EditUserHandler
|
|||
}
|
||||
}
|
||||
|
||||
if ($actor->isAdmin() && ! empty($attributes['isActivated'])) {
|
||||
if ($actor->isAdmin() && ! empty($attributes['isEmailConfirmed'])) {
|
||||
$user->activate();
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ class RegisterUserHandler
|
|||
}
|
||||
}
|
||||
|
||||
if ($actor->isAdmin() && array_get($data, 'attributes.isActivated')) {
|
||||
if ($actor->isAdmin() && array_get($data, 'attributes.isEmailConfirmed')) {
|
||||
$user->activate();
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class CreateUserControllerTest extends ApiControllerTestCase
|
|||
$this->actor = $this->getAdminUser();
|
||||
|
||||
$response = $this->callWith(array_merge($this->data, [
|
||||
'isActivated' => 1
|
||||
'isEmailConfirmed' => 1
|
||||
]));
|
||||
|
||||
$this->assertEquals(201, $response->getStatusCode());
|
||||
|
|
Loading…
Reference in New Issue
Block a user