Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds indieauth sign-in form so people can create accounts for themsel…
…ves!
- Loading branch information
Showing
12 changed files
with
163 additions
and
139 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class Controller < Sinatra::Base | ||
|
||
get '/auth/start' do | ||
redirect "https://indieauth.com/auth?client_id=#{SiteConfig.base_url}/&redirect_uri=#{SiteConfig.base_url}/auth/callback" | ||
end | ||
|
||
get '/auth/indieauth/callback' do | ||
auth = request.env["omniauth.auth"] | ||
puts auth.info.url.inspect | ||
domain = URI.parse(auth.info.url).host.downcase | ||
|
||
user = Account.first :domain => domain | ||
|
||
if user.nil? | ||
user = Account.new | ||
user.username = domain | ||
user.domain = domain | ||
user.created_at = Time.now | ||
user.updated_at = Time.now | ||
end | ||
|
||
user.last_login = Time.now | ||
user.save | ||
|
||
session[:user_id] = user[:id] | ||
puts "User successfully logged in" | ||
redirect "/dashboard" | ||
end | ||
|
||
end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.