Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
501ce34d
Commit
501ce34d
authored
Dec 20, 2018
by
Ivan Tashkinov
Browse files
[
#114
] Stylistic adjustments.
parent
b520d44b
Changes
1
Show whitespace changes
Inline
Side-by-side
lib/pleroma/user.ex
View file @
501ce34d
...
...
@@ -76,15 +76,14 @@ def follow_changeset(struct, params \\ %{}) do
def
user_info
(%
User
{}
=
user
)
do
oneself
=
if
user
.
local
,
do
:
1
,
else
:
0
user_info
=
user
.
info
%{
following_count:
length
(
user
.
following
)
-
oneself
,
note_count:
user
_
info
.
note_count
,
follower_count:
user
_
info
.
follower_count
,
locked:
user
_
info
.
locked
,
confirmation_pending:
user
_
info
.
confirmation_pending
,
default_scope:
user
_
info
.
default_scope
note_count:
user
.
info
.
note_count
,
follower_count:
user
.
info
.
follower_count
,
locked:
user
.
info
.
locked
,
confirmation_pending:
user
.
info
.
confirmation_pending
,
default_scope:
user
.
info
.
default_scope
}
end
...
...
@@ -182,6 +181,8 @@ def register_changeset(struct, params \\ %{}, opts \\ []) do
:unconfirmed
end
info_change
=
User
.
Info
.
confirmation_changeset
(%
User
.
Info
{},
confirmation_status
)
changeset
=
struct
|>
cast
(
params
,
[
:bio
,
:email
,
:name
,
:nickname
,
:password
,
:password_confirmation
])
...
...
@@ -193,7 +194,7 @@ def register_changeset(struct, params \\ %{}, opts \\ []) do
|>
validate_format
(
:email
,
@email_regex
)
|>
validate_length
(
:bio
,
max:
1000
)
|>
validate_length
(
:name
,
min:
1
,
max:
100
)
|>
put_change
(
:info
,
User
.
Info
.
confirmation_changeset
(%
User
.
Info
{},
confirmation_status
)
)
|>
put_change
(
:info
,
info_change
)
if
changeset
.
valid?
do
hashed
=
Pbkdf2
.
hashpwsalt
(
changeset
.
changes
[
:password
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment