-
-
Save motephyr/8b56bc136d9d6015cf3eab1be3903a40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def password_match(conn, _) do | |
| owner = Coherence.current_user(conn) | |
| house = conn.assigns[:house] | |
| password = conn.params["house_bid"]["password"] | |
| result = Config.user_schema.checkpw(password, Map.get(owner, Config.password_hash)) | |
| if result do | |
| conn | |
| else | |
| conn | |
| |> put_flash(:error, "密碼不正確") | |
| |> redirect(to: house_path(conn, :show, house)) | |
| |> halt | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment