Skip to content

Commit

Permalink
Support for Genie v2
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary committed Jun 21, 2021
1 parent b594ca6 commit 04cbaed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name = "GenieAuthentication"
uuid = "e115e502-7e3a-11e9-29b2-aba8be6c6778"
authors = ["Adrian Salceanu <e@essenciary.com>"]
version = "1.0"
version = "1.0.0"

[deps]
Genie = "c43c736e-a2d1-11e8-161f-af95117fbd1e"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
SearchLight = "340e8cb6-72eb-11e8-37ce-c97ebeb32050"

[compat]
Genie = "1"
Genie = "1, 2"
SearchLight = "0.21, 0.22, 1"
julia = "1"
julia = "1"
16 changes: 8 additions & 8 deletions files/app/resources/authentication/AuthenticationController.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ end

function login()
try
user = findone(User, username = @params(:username), password = Users.hash_password(@params(:password)))
authenticate(user.id, Genie.Sessions.session(@params))
user = findone(User, username = params(:username), password = Users.hash_password(params(:password)))
authenticate(user.id, Genie.Sessions.session(params()))

redirect(:success)
catch ex
Expand All @@ -30,7 +30,7 @@ function success()
end

function logout()
deauthenticate(Genie.Sessions.session(@params))
deauthenticate(Genie.Sessions.session(params()))

flash("Good bye! ")

Expand All @@ -43,12 +43,12 @@ end

function register()
try
user = User(username = @params(:username),
password = @params(:password) |> Users.hash_password,
name = @params(:name),
email = @params(:email)) |> save!
user = User(username = params(:username),
password = params(:password) |> Users.hash_password,
name = params(:name),
email = params(:email)) |> save!

authenticate(user.id, Genie.Sessions.session(@params))
authenticate(user.id, Genie.Sessions.session(params()))

"Registration successful"
catch ex
Expand Down

0 comments on commit 04cbaed

Please sign in to comment.