OpenID蒸汽会话管理

时间:2015-11-19 14:09:40

标签: node.js session

因为这是我第一次使用session和openID,所以我会盲目地经历这个。我认为我通过快速会话管理并将会话存储在mongodb站点。
我实际上要做的是让人们登录网站,一旦他们回来,这个会话是活跃的(所以我可以比较有些人在Angular中(如果有人被记录,请带上他们的id,为他们显示特殊内容)。或者让登录按钮在他们登录后消失。

这是我的代码处理会话的一部分,我甚至不知道它旁边是否正常工作没有错误。

//viewController...
override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    let realm = try! Realm()
    let books = realm.objects(Book)
    viewModel = BookListViewModel(books: Array(books), onSelection: onSelection, onDeleteFailure: onDeleteFailure)
}
//end viewController

extension BookListViewModel: UITableViewDataSource {
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier(BookTableViewCell.nibName, forIndexPath: indexPath) as! BookTableViewCell
        cell.bind(bookCellViewModels[indexPath.row])

        // NOTE:
        // bookCellViewModels[indexPath.row].book all properties are valid strings
        return cell
    }

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return bookCellViewModels.count
    }
}

extension BookListViewModel: UITableViewDelegate {
    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        let book = bookCellViewModels[indexPath.row].book

        // NOTE:
        // all book properties are empty string or nil
        onSelection(book)
        tableView.deselectRowAtIndexPath(indexPath, animated: true)
    }
}

任何想法我现在如何让用户并比较他是否登录角度?然后根据它隐藏或显示内容。一旦用户登录,我想在数据库中的其他地方更新记录。非常感谢任何指导。

0 个答案:

没有答案